package cate.game.pvp.guildwar.data.base;

import cate.common.table.d.GDGuildWar;
import cate.common.util.TimeTool;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;

@NoteClass("公会战赛季数据")
@Slf4j
public class GuildWarBase {

	@NoteField("当前赛季")
	public int index;

	@NoteField("赛季开始时间")
	public long startTime;

	@NoteField("赛季结束时间")
	public long endTime;

	public void initialize() {
		if (index <= 0) {
			index = 1;
		}
		if (startTime <= 0 || endTime <= 0) {
			setStartTime(TimeTool.getZeroTimeStamp(System.currentTimeMillis()));
		}
		print();
	}

	public void setStartTime(long startTime) {
		this.startTime = startTime;
		this.endTime = startTime + GDGuildWar.SEASON_DAY * TimeTool.TimeCons.DAY;
	}

	public void print(){
		log.info("[公会战] 当前赛季[{}] 开始时间:{} 结束时间:{}", index,
				TimeTool.getDF2().format(new Date(startTime)), TimeTool.getDF2().format(new Date(endTime)));
	}
}
